<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

//商品
class CreateProductGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_product_goods')) {
            Schema::create('c_product_goods', function (Blueprint $table) {
                $table->increments('id')->comment('自增ID');
                $table->string('product_name', 100)->comment('商品名称');
                $table->string('product_unit', 100)->comment('商品单位');
                $table->integer('product_sort_id')->comment('产品分类id');
                $table->integer('product_brand_id')->comment('品牌分类id');
                $table->string('product_image')->comment('商品图片');
                $table->text('product_detail_image_one')->comment('商品详情图片1');
                $table->text('product_detail_image_two')->comment('商品详情图片2');
                $table->text('product_detail_image_three')->comment('商品详情图片3');
                $table->text('product_detail_image_four')->comment('商品详情图片4');
                $table->text('product_detail_image_five')->comment('商品详情图片5');
                $table->string('product_rests_image')->default("")->nullable()->comment('其他图片');
                $table->decimal('product_retail_price')->comment('产品现价');
                $table->decimal('product_original_price')->comment('产品原价');
                $table->decimal('product_cost_price')->comment('产品成本价');
                $table->string('product_label')->comment('产品标签');
                $table->string('product_coding')->comment('产品编码');
                $table->string('product_bar_code')->comment('产品条形码');
                $table->tinyInteger('product_add_type')->default(0)->comment('0:后端,1:医护端,2:供应商');
                $table->tinyInteger('product_racking')->default(1)->nullable()->comment('是否上架(1:下架,2:上架)');
                $table->integer('product_sales')->default(0)->nullable()->comment('销量');
                $table->integer('product_score')->default(0)->nullable()->comment('评分');
                $table->integer('product_stock')->comment('库存数');
                $table->string('product_param')->default(0)->nullable()->comment('产品参数');
                $table->string('product_source')->default(0)->comment('医护端(自营),供应商');
                $table->tinyInteger('product_audit_status')->default(1)->nullable()->comment('审核状态(1:待审核，2:审核通过)');
                $table->integer('product_add_user_id')->comment('添加用户');
                $table->integer('product_audit_user_id')->default(0)->nullable()->comment('经销不需要审核所以经销商审核id是用户自己id');
                $table->timestamps();
                $table->comment = '商品表';
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_product_goods');
    }
}
